let timers = {}

export default {
  methods: {
    exec_timeout (key, callback, timeout) {
      // 防抖
      if (timers[key]) {
        clearTimeout(timers[key])
        timers[key] = null
      }
      if (typeof timeout === 'undefined') {
        timeout = 100
      }
      timers[key] = setTimeout(_ => {
        timers[key] = null
        callback()
      }, timeout)
    }
  }
}
